/* ======================================================= */
/* 1. ESTILOS GERAIS E LAYOUT PRINCIPAL (selection.html) */
/* ======================================================= */

body {
    margin: 0;
    padding: 0;
    background-color: #000;
    font-family: sans-serif;
    min-height: 100vh;
}

.selection-container {
    width: 100vw; 
    height: 100vh; 
    
    /* Fundo Inicial (o fundo de estrelas) */
    background-image: url('./assets/fundo\ da\ pagina\ de\ seleção.png'); 
    
    /* Enquadramento em tela cheia */
    background-size: cover; 
    background-position: center top; 
    background-repeat: no-repeat;
    
    /* Transição para troca de fundo via JS (para o hover) */
    transition: background-image 0.5s ease-in-out; 
    
    display: flex;
    flex-direction: column; 
    align-items: center; 
    justify-content: flex-end; /* Alinha o conteúdo na parte inferior */
    box-sizing: border-box;
    padding-bottom: 8vh; /* Espaço para o rodapé */
}

/* ======================================================= */
/* 2. LAYOUT DOS PERSONAGENS (Quadros) */
/* ======================================================= */

.character-frames {
    display: flex; 
    justify-content: center; 
    align-items: flex-end; 
    gap: 20px; 
    z-index: 2;
    
    /* CORREÇÃO PARA RESPONSIVIDADE EM CELULARES */
    width: 100%; /* Ocupa 100% da largura da tela */
    overflow-x: auto; /* PERMITE A ROLAGEM HORIZONTAL SE O CONTEÚDO EXCEDER */
    padding: 0 10px; /* Adiciona um pequeno padding nas laterais */
    box-sizing: border-box;
}

.character-frame {
    /* O 'flex-shrink: 0' impede que os itens sejam espremidos em telas apertadas */
    flex-shrink: 0; 
    width: 180px; 
    height: auto;
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: brightness(0.7); 
}

.char-image {
    width: 100%;
    height: 100%;
    display: block;
}

/* Estado de Seleção (Quando a classe .selected é adicionada por clique) */
.character-frame.selected {
    transform: scale(1.15) translateY(-25px); 
    filter: brightness(1.0); 
    z-index: 5;
}

/* ======================================================= */
/* 3. CAIXA DE DESCRIÇÃO (Tooltip) */
/* ======================================================= */

.description-box {
    position: fixed; 
    top: 30px; 
    right: 30px; 
    width: 300px; 
    max-height: 200px; 
    padding: 20px;
    background: rgba(0, 0, 0, 0.8); 
    border: 2px solid #4b6a8a; 
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.7);
    color: #f0e6d2; 
    font-family: 'Times New Roman', serif; 
    font-size: 1.1em;
    line-height: 1.4;
    text-align: left;
    overflow-y: auto; 
    
    /* Efeito de fade-in/out */
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px); 
    transition: opacity 0.3s ease-out, transform 0.3s ease-out, visibility 0.3s ease-out;
    z-index: 10; 
}

.description-box.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* ======================================================= */
/* 4. RODAPÉ RPG ("Escolha um Caminho") */
/* ======================================================= */

.rpg-footer {
    position: absolute; 
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6vh; 
    display: flex;
    justify-content: center;
    align-items: center;
    
    background: rgba(0, 0, 0, 0.7); 
    border-top: 2px solid #4b6a8a; 
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.5);
    z-index: 1; 
}

.rpg-footer p {
    margin: 0;
    padding: 0;
    font-family: serif; 
    font-size: 1.5em;
    color: #f0e6d2; 
    text-shadow: 0 0 5px #000, 0 0 10px #4b6a8a; 
    letter-spacing: 3px;
    font-weight: bold;
}

/* ======================================================= */
/* 5. BOTÃO DE VOLTAR */
/* ======================================================= */

.back-button {
    position: absolute;
    top: 30px; 
    left: 30px; 
    font-size: 3em;
    color: #4b6a8a; 
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
    cursor: pointer;
    z-index: 10;
    background: rgba(0, 0, 0, 0.4);
    padding: 5px 15px;
    border-radius: 5px;
    border: 1px solid #4b6a8a;
}

.back-button:hover {
    color: #8cefff; 
    transform: scale(1.1);
}

/* ======================================================= */
/* 6. TELA DE CARREGAMENTO (LOADER) */
/* ======================================================= */

#loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000; 
    background-color: #000; 
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.5s ease-out, visibility 0.5s; 
    visibility: visible;
}

#loader-wrapper.loaded {
    opacity: 0; 
    visibility: hidden; 
    pointer-events: none; 
}

.rpg-loader {
    font-size: 2em;
    color: #f0e6d2; 
    text-shadow: 0 0 5px #ffcc00, 0 0 10px #ff9900; 
    font-weight: bold;
    letter-spacing: 5px;
    animation: pulse 1.5s infinite alternate; 
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.8; }
    100% { transform: scale(1.1); opacity: 1; }
}

/* ======================================================= */
/* 7. MEDIA QUERIES (Responsividade para selection.html) */
/* ======================================================= */

/* Ajustes para Tablets e Monitores Menores (até 900px) */
@media (max-width: 900px) {
    .character-frames {
        gap: 15px;
    }
    .character-frame {
        width: 140px; 
    }
    .character-frame.selected {
         transform: scale(1.1) translateY(-20px); 
    }
    .description-box {
        width: 250px;
        font-size: 0.9em;
        top: 20px;
        right: 20px;
        padding: 15px;
    }
}

/* Ajustes para Celulares (até 600px) */
@media (max-width: 600px) {
    .character-frames {
        /* Garante que o espaçamento seja menor para caber mais */
        gap: 10px;
        /* Remove o justify-content: center para permitir a rolagem a partir do centro */
        justify-content: flex-start; 
    }
    .character-frame {
        width: 100px; /* Tamanho mínimo do personagem no celular */
    }
    .back-button {
        font-size: 2em;
        top: 15px;
        left: 15px;
    }
    .rpg-footer {
        height: 5vh;
    }
    .rpg-footer p {
        font-size: 1em;
        letter-spacing: 2px;
    }
    /* Centraliza e torna a caixa de descrição mais compacta no celular */
    .description-box {
        width: 90%; 
        top: 10px;
        right: 5%;
        left: 5%; 
        margin: 0 auto;
        padding: 10px;
        font-size: 0.8em;
    }
}





/* ======================================================= */
/* 8. MODAL DE CONFIRMAÇÃO */
/* ======================================================= */

/* Camada que escurece e centraliza o modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Fundo bem escuro */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Acima de TUDO */
    
    /* Esconde o modal por padrão */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-out;
}

/* Estado visível (controlado pelo JS) */
.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Caixa central do conteúdo */
.modal-content {
    background: #1a1a1a; /* Fundo mais escuro que a borda */
    border: 3px solid #4b6a8a; /* Borda azul/cinza RPG */
    border-radius: 10px;
    padding: 30px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.9);
    
    /* Efeito de pop-in */
    transform: scale(0.8);
    transition: transform 0.3s ease-out;
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

#modal-title {
    color: #ffcc00; /* Dourado */
    font-family: serif;
    font-size: 2em;
    margin-bottom: 10px;
}

#modal-text {
    color: #f0e6d2; /* Cor de texto claro */
    font-size: 1.1em;
    line-height: 1.5;
    margin-bottom: 25px;
}

#character-name-display {
    font-weight: bold;
    color: #8cefff; /* Nome do personagem em destaque */
}

/* Container dos botões */
.modal-buttons {
    display: flex;
    justify-content: space-around;
    gap: 15px;
}

/* Estilo dos botões */
.modal-button {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    transition: background-color 0.2s ease, transform 0.1s ease;
    width: 100%;
}

.btn-confirm {
    background-color: #4b6a8a; /* Botão de ação principal */
    color: #fff;
}

.btn-confirm:hover {
    background-color: #5d83ae;
    transform: scale(1.05);
}

.btn-cancel {
    background-color: #333; /* Botão secundário/cancelar */
    color: #ccc;
    border: 1px solid #555;
}

.btn-cancel:hover {
    background-color: #444;
    transform: scale(1.05);
}